/* ************************************************************************ */
/*                                                                          */
/*  Copyright (c)2005 Russell Weir | damonsbane _at_ gmail                  */
/*                                                                          */
/* This library is free software; you can redistribute it and/or            */
/* modify it under the terms of the GNU Lesser General Public               */
/* License as published by the Free Software Foundation; either             */
/* version 3.0 of the License, or (at your option) any later version.       */
/*                                                                          */
/* This library is distributed in the hope that it will be useful,          */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        */
/* Lesser General Public License or the LICENSE file for more details.      */
/*                                                                          */
/* ************************************************************************ */

package tzparser;

class RuleForYear extends Rule {
	public var julian(default,null)	: altdate.JulianDay;
	var year			: Int;

	public function new(r:Rule, year:Int) {
		super();
		copy(r);
		this.year = year;
		julian = null;
	}

	public function toJulianDay(utcOffset, stdOffset) : altdate.JulianDay {
		var month = until.month;
		var day = until.onDay.getValue(year, month);
		julian = until.atTime.toJulianDay(year,month,day,utcOffset,stdOffset);
		return julian;
	}

	function copy(r:Rule) : Void {
		name = r.name;
		validFromYear = r.validFromYear;
		until = r.until;
		save = r.save;
		letter = r.letter;
	}
}